#include "server.h"

extern MYSQL* mySql;

//获取当前路径，通过传入传出参数返回
int PwdDir(char* cwd, int userId){
    char querySentence[1024] = {0};
    sprintf(querySentence, "select pwd from user where id = %d", userId);
    int ret = mysql_query(mySql, querySentence);
    MYSQL_ERROR_CHECK(ret, mySql);
    MYSQL_RES* result = mysql_store_result(mySql);
    MYSQL_ERROR_CHECK_RESULT(result, mysql);
    MYSQL_ROW row = mysql_fetch_row(result);
    strcpy(cwd, row[0]);
    mysql_free_result(result);
    return 0;
}
